﻿@model PagedList.IPagedList<VOD.Models.Video>
@using VOD.Helpers;
@{
    ViewBag.Title = "List";
}

<h1>视频列表</h1>
<div class="searchBox">
    @using (Html.BeginForm())
    {
        <p>视频名称：@Html.TextBox("searchString", ViewBag.CurrentFilter as string, new { @class = "ui-widget-content text ui-corner-all",style="padding:2px;" })&nbsp;
            <input id="btnSearch" type="submit" value="搜索" />
        </p>
    }    
</div>

<table>
    <tr class="thead">
        <th width="117">名称</th>
        <th width="120">主演</th>
        <th width="70">更新时间</th>
        <th width="180">简介</th>
        <th width="46">语言</th>
        <th width="46">分类</th>
        <th width="46">地区</th>
        <th width="96"></th>
    </tr>
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink(Html.Truncate(item.Name,8),"Details","VideoMgr",new{id=item.VideoID},new{title=item.Name})
        </td>
        <td title="@item.Actor">
            @Html.Truncate(item.Actor, 14)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.UpdateDate)
        </td>
        <td title="@item.Intro">
            @Html.Truncate(item.Intro,30)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.VideoLanguage.LangName)
        </td>
        <td>
            @foreach (var type in item.VideoAndTypes)
            {
                @type.VideoType.TypeName @:<br />
            }
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.VideoArea.AreaName)
        </td>
        <td>
            @Html.ActionLink("编辑信息", "EditInfo", new { id=item.VideoID }) |
            @Html.ActionLink("查看", "Details", new { id=item.VideoID })<br />
            @Html.ActionLink("文件管理","EditFiles",new{id=item.VideoID}) |
            @Html.ActionLink("删除", "Delete", new { id=item.VideoID })
        </td>
    </tr>
}

</table>
@*分页*@
@if (Model.PageCount > 1)
{
<div class="paging">
    @if (Model.IsFirstPage)
    {
        @:<a>|<</a>
        @:<a><</a>
    }
    else
    {
        @Html.ActionLink("|<", "Category", new { id = ViewBag.ID, page = 1, currentFilter = ViewBag.CurrentFilter })
        @Html.ActionLink("<", "Category", new { id = ViewBag.ID, page = Model.PageNumber -1, currentFilter = ViewBag.CurrentFilter })
    }
    @for (int i = 1; i <= Model.PageCount; i++)
    {
        @Html.ActionLink(i.ToString(), "Category", new { id = ViewBag.ID, page = i, currentFilter = ViewBag.CurrentFilter }) 
    }
    @if (Model.IsLastPage)
    {
        @:<a>></a>
        @:<a>>|</a>
    }
    else
    {
        @Html.ActionLink(">", "Category", new { id = ViewBag.ID, page = Model.PageNumber + 1, currentFilter = ViewBag.CurrentFilter }) 
        @Html.ActionLink(">|", "Category", new { id = ViewBag.ID, page = Model.PageCount, currentFilter = ViewBag.CurrentFilter })
    }
</div>
}
<script type="text/javascript">
    $("#btnSearch").button();
</script>